/*
package com.songshuai.sales.client.aop;

import com.songshuai.webapi.baseapi.enumerations.ResultStatus;
import com.songshuai.webapi.baseapi.pojo.QueryResponse;
import com.songshuai.webapi.common.redis.RedisUtil;
import org.apache.commons.lang.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.concurrent.CompletableFuture;


@Aspect
@Component
public class SSOAspect {

    @Autowired
    private HttpServletRequest request;

    @Autowired
    private RedisUtil redisUtil;


    @Pointcut("within(com.songshuai.sales.client.controller.*)")
    public void rlAop(){

    }

    @Around("rlAop()")
    public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        MethodSignature signature = (MethodSignature) proceedingJoinPoint.getSignature();
        ServletRequestAttributes attributes =
                (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = attributes.getRequest();
        String token = request.getHeader("token");
        if(StringUtils.isNotBlank(token)){
            refashtoken(token);
            Object proceed = proceedingJoinPoint.proceed();
            return proceed;
        }else{
            return CompletableFuture.supplyAsync(()->{
                return new QueryResponse(ResultStatus.FAIL);
            });

        }
    }

    public void refashtoken(String token){
        request.setAttribute("token",token);
    }
}
*/
